package com.ocl.www;

//import static com.google.common.base.Predicates.or;
//import static springfox.documentation.builders.PathSelectors.regex;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.http.ResponseEntity;
//import com.google.common.base.Predicate;
//import com.google.common.base.Predicates;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * Created by gxl on 2016/12/8.
 */
@Configuration
@EnableSwagger2
public class Swagger2 {

    @Bean
    public Docket createRestApi() {
        System.out.println(PathSelectors.any()+"===========com.didispace.web===================================================");
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.ocl.www.controller"))
                .paths(PathSelectors.any())
                .build();
    }

    private ApiInfo apiInfo() {
        //.contact("=================文档数据量大初始化加载缓慢，请耐心等待！===============")
        return new ApiInfoBuilder()
                .title("CALLBELL·单杯生活馆·API")//"Spring Boot中使用Swagger2构建RESTful APIs"
                .description("单杯生活馆API文档")
                .termsOfServiceUrl("http://about.callbell.cn/callbellpage/index2.html")
                .contact("单杯生活馆·程序猿·郭晓林")
                .version("1.0")
                .build();
    }

}


//文／程序猿DD（简书作者）
//        原文链接：http://www.jianshu.com/p/8033ef83a8ed
//        著作权归作者所有，转载请联系作者获得授权，并标注“简书作者”。
